<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <img src = "../HTML/img/星星.png" alt = "图片加载失败" title = "这是一颗星星" width= "100px" height= "100px">
</body>
<script>
    //修改元素
    let img = document.querySelector("img");
    console.dir(img);
    img.title = "title已经修改完毕";
    img.onclick = function()
    {
        alert("你已经点击图片了！");
    }
</script>
</html>